package xyc.szk.web.servlet;
/*
 * @Description: 使用servlet
 * @Author: 山志凯
 * @Date: 2021-03-12 14:24
 */

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
@WebServlet(value = "/demo01",loadOnStartup = 0) //它的值默认为-1，表示的是当浏览器第一次访问这个servlet时，tomcat容器对它初始化

public class DemoServlet01 implements Servlet{
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        //init用来初始化servlet
        //它只会运行一次：第一次请求这个servlet或
    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("demoServlet01");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
